//
//  NSUserDefaults+Addition.m
//  BytalkApp
//
//  Created by zhihuiguan on 13-3-18.
//  Copyright (c) 2013年 zhihuiguan. All rights reserved.
//

#import "NSUserDefaults+Addition.h"
//登录返回值添加一个rank字段，获取动态分类添加一个接口
NSString *const APPDefaultsKeyRank=@"app_rank";
NSString *const APPDefaultsKeyShowGpTrends=@"app_showGpTrends";
NSString *const APPDefaultsKeygpTrendsButton=@"app_gpTrendsButton";
NSString *const APPDefaultsKeyShowAreaTrends=@"app_showAreaTrends";
NSString *const APPDefaultsKeyAreaTrendsButton=@"app_areaTrendsButton";


NSString *const APPDefaultsKeyPrivacy = @"privacy";
NSString *const APPDefaultsKeyHostAddress = @"app_hostAddress";
NSString *const APPDefaultsKeyHostDomain = @"app_hostDomain";
NSString *const APPDefaultsKeyFTPServer = @"app_ftpServer";
NSString *const APPDefaultsKeyFTPUsername = @"app_ftpUserName";
NSString *const APPDefaultsKeyFTPPassword = @"app_ftPassword";
NSString *const APPDefaultsKeyURLServer = @"app_urlServer";//图片视频http服务器地址
NSString *const APPDefaultsKeyUPLOADURLServer = @"app_uploadUrlServer";//图片视频上传http服务器地址
NSString *const APPDefaultsKeyWebBaseUrl=@"app_webBaseUrl";
//NSString *const APPDefaultsKeyUserName=@"app_userName";
NSString *const APPDefaultsKeyCookie=@"app_cookie";
NSString *const APPDefaultsKeyUserInfo=@"app_userInfo";
NSString *const APPDefaultsKeyUserJid = @"app_userjid";
NSString *const APPDefaultsKeyPassword = @"app_password";
NSString *const APPDefaultsKeyUserGroupRank = @"app_usergrouprank";
NSString *const APPDefaultsKeyHostname = @"app_hostname";
NSString *const APPDefaultsKeyPoot = @"app_poot";
NSString *const APPDefaultsKeyDeviceToken = @"app_divicetoken";
NSString *const APPDefaultsKeyDataHolder = @"app_dataHolder";
NSString *const APPDefaultsKeyDiscussionJid = @"app_discussionJid";
NSString *const APPDefaultsKeyPresenceBroadcaster=@"app_presenceBroadcaster";
NSString *const APPDefaultsKeyAutoLogin=@"app_autoLogin";
NSString *const APPDefaultsKeyLoginID=@"app_loginid";
NSString *const APPDefaultsKeyUserNameDomain=@"app_userNameDomain";
NSString *const APPDefaultsKeyBytalkcrowdid=@"app_bytalkcrowdid";
NSString *const APPDefaultsKeyUploadingFiles=@"app_uploadingFiles";
NSString *const APPDefaultsKeyUploadingFilesForGroupChat=@"app_uploadingFilesForGroupChat";
NSString *const APPDefaultsKeyWantsFullScreen=@"app_wantsFullScreen";
NSString *const APPDefaultsKeyUserStatus=@"app_userStatus";
NSString *const APPDefaultsKeyIsHaveSound=@"app_isHaveSound";

//群消息
NSString *const APPDefaultsKeyIsHaveGroupSound=@"app_isHaveGroupSound";


NSString *const APPDefaultsKeyEverLaunched=@"app_everLaunched";
NSString *const APPDefaultsKeyFirstLaunched=@"app_firstLaunched";
NSString *const APPDefaultsKeyCanCreateGroup=@"app_canCreateGroup";
NSString *const APPDefaultsKeyCanSendNotice=@"app_canSendNotice";
NSString *const APPDefaultsKeyAvatarUploadURL=@"app_avatarUploadURL";
NSString *const APPDefaultsKeyAvatarDownloadURL=@"app_avatarDownloadURL";
NSString *const APPDefaultsKeyGroupTreeVersion=@"app_groupTreeVersion";
NSString *const APPDefaultsKeyUserInputName=@"app_userInputName";
NSString *const APPDefaultsKeyICanTalk=@"icantalk";
@implementation NSUserDefaults (Addition)
- (void)app_setRank:(NSString *)app_rank {
    [self setObject:app_rank forKey:APPDefaultsKeyRank];
}

- (NSString *)app_rank {
    return [self stringForKey:APPDefaultsKeyRank];
}

- (void)app_setShowGpTrends:(NSString *)app_showGpTrends {
    [self setObject:app_showGpTrends forKey:APPDefaultsKeyShowGpTrends];
}

- (NSString *)app_showGpTrends {
    return [self stringForKey:APPDefaultsKeyShowGpTrends];
}


- (void)app_setGpTrendsButton:(NSString *)app_gpTrendsButton {
    [self setObject:app_gpTrendsButton forKey:APPDefaultsKeygpTrendsButton];
}

- (NSString *)app_gpTrendsButton {
    return [self stringForKey:APPDefaultsKeygpTrendsButton];
}

- (void)app_setShowAreaTrends:(NSString *)app_showAreaTrends {
    [self setObject:app_showAreaTrends forKey:APPDefaultsKeyShowAreaTrends];
}

- (NSString *)app_showAreaTrends {
    return [self stringForKey:APPDefaultsKeyShowAreaTrends];
}

- (void)app_setAreaTrendsButton:(NSString *)app_areaTrendsButton {
    [self setObject:app_areaTrendsButton forKey:APPDefaultsKeyAreaTrendsButton];
}

- (NSString *)app_areaTrendsButton {
    return [self stringForKey:APPDefaultsKeyAreaTrendsButton];
}


- (NSString *)app_privacy{
    return [self stringForKey:APPDefaultsKeyPrivacy];
}

- (void)app_privacy:(NSString *)app_privacy {
    [self setObject:app_privacy forKey:APPDefaultsKeyPrivacy];
}

- (NSString *)app_hostAddress {
    return [self stringForKey:APPDefaultsKeyHostAddress];
}

- (void)app_setHostAddress:(NSString *)app_hostAddress {
    [self setObject:app_hostAddress forKey:APPDefaultsKeyHostAddress];
}

- (NSString *)app_hostDomain {
    return [self stringForKey:APPDefaultsKeyHostDomain];
}

- (void)app_setHostDomain:(NSString *)app_hostDomain {
    [self setObject:app_hostDomain forKey:APPDefaultsKeyHostDomain];
}

- (NSString *)app_ftpServer {
    return [self stringForKey:APPDefaultsKeyFTPServer];
}

- (void)app_setFtpServer:(NSString *)app_ftpServer {
    [self setObject:app_ftpServer forKey:APPDefaultsKeyFTPServer];
}

- (NSString *)app_urlServer {
    return [self stringForKey:APPDefaultsKeyURLServer];
}

- (void)app_setUrlServer:(NSString *)app_urlServer {
    [self setObject:app_urlServer forKey:APPDefaultsKeyURLServer];
}

- (NSString *)app_uploadUrlServer {
    return [self stringForKey:APPDefaultsKeyUPLOADURLServer];
}

- (void)app_setUploadUrlServer:(NSString *)app_uploadUrlServer {
    [self setObject:app_uploadUrlServer forKey:APPDefaultsKeyUPLOADURLServer];
}

- (NSString *)app_ftpUsername {
    return [self stringForKey:APPDefaultsKeyFTPUsername];
}

- (void)app_setFtpUsername:(NSString *)app_ftpUsername {
    [self setObject:app_ftpUsername forKey:APPDefaultsKeyFTPUsername];
}

- (NSString *)app_ftpPassword {
    return [self stringForKey:APPDefaultsKeyFTPPassword];
}

-(NSString *)app_presenceBroadcaster{
    return [self stringForKey:APPDefaultsKeyPresenceBroadcaster];
}

- (void)app_setFtpPassword:(NSString *)app_ftpPassword {
    [self setObject:app_ftpPassword forKey:APPDefaultsKeyFTPPassword];
}
- (void)app_setWebBaseUrl:(NSString *)app_webBaseUrl{
    [self setObject:app_webBaseUrl forKey:APPDefaultsKeyWebBaseUrl];
}
//- (void)app_setUserName:(NSString *)app_userName{
//    [self setObject:app_userName forKey:APPDefaultsKeyUserName];
//}

- (void)app_setCookie:(NSData *)app_cookie{
    [self setObject:app_cookie forKey:APPDefaultsKeyCookie];
}
- (void)app_setUserInfo:(NSDictionary *)app_userInfo{
    [self setObject:app_userInfo forKey:APPDefaultsKeyUserInfo];
}
- (void)app_setPresenceBroadcaster:(NSString *)app_presenceBroadcaster{
    [self setObject:app_presenceBroadcaster forKey:APPDefaultsKeyPresenceBroadcaster];
}

-(void)app_setAutoLogin:(BOOL)app_autoLogin
{
    [self setObject:[NSNumber numberWithBool:app_autoLogin] forKey:APPDefaultsKeyAutoLogin];
}


-(BOOL)app_autoLogin{
    return [[self objectForKey:APPDefaultsKeyAutoLogin] boolValue];
}
- (NSString *)app_userJid {
    return [self stringForKey:APPDefaultsKeyUserJid];
}

- (void)app_setUserJid:(NSString *)userJid {
    [self setObject:userJid forKey:APPDefaultsKeyUserJid];
}

- (NSString *)app_password {
    return [self stringForKey:APPDefaultsKeyPassword];
}

- (void)app_setPassword:(NSString *)app_password {
    [self setObject:app_password forKey:APPDefaultsKeyPassword];
}

- (NSString *)app_hostname {
    return [self stringForKey:APPDefaultsKeyHostname];
}
//-(NSString *)app_userName
//{
//    return [self stringForKey:APPDefaultsKeyUserName];
//}

-(NSData *)app_cookie
{
    return [self objectForKey:APPDefaultsKeyCookie];
}
-(NSDictionary *)app_userInfo
{
    return [self dictionaryForKey:APPDefaultsKeyUserInfo];
}
- (void)app_setHostname:(NSString *)app_hostname {
    [self setObject:app_hostname forKey:APPDefaultsKeyHostname];
}

- (int)app_poot {
    return [[self stringForKey:APPDefaultsKeyPoot] intValue];
}

- (void)app_setPoot:(int)app_poot {
    [self setObject:[NSString stringWithFormat:@"%d",app_poot] forKey:APPDefaultsKeyPoot];
}

-(void)app_setLoginID:(NSString *)app_loginid{
    [self setObject:app_loginid forKey:APPDefaultsKeyLoginID];
}
-(void)app_setUserNameDomain:(NSString *)app_userNameDomain{
    [self setObject:app_userNameDomain forKey:APPDefaultsKeyUserNameDomain];
}

-(NSString *)app_userNameDomain{
    return [self stringForKey:APPDefaultsKeyUserNameDomain];
}
-(NSString *)app_loginid{
    return [self stringForKey:APPDefaultsKeyLoginID];
}

-(NSString *)app_webBaseUrl{
    return [self stringForKey:APPDefaultsKeyWebBaseUrl];
}

- (NSString *)app_divicetoken {
    return [self stringForKey:APPDefaultsKeyDeviceToken];
}

- (void)app_setDivicetoken:(NSString *)app_divicetoken {
    [self setObject:app_divicetoken forKey:APPDefaultsKeyDeviceToken];
}

- (NSDictionary*)app_dataHolder{
    return (NSDictionary*)[self stringForKey:APPDefaultsKeyDataHolder];
}

- (void)app_setDataHolder:(NSDictionary *)app_dataHolder {
    [self setObject:app_dataHolder forKey:APPDefaultsKeyDataHolder];
}

- (NSString *)app_discussionJid {
    return [self stringForKey:APPDefaultsKeyDiscussionJid];
}

- (void)app_setDiscussionJid:(NSString*)app_discussionJid{
    [self setObject:app_discussionJid forKey:APPDefaultsKeyDiscussionJid];
}


- (NSArray *)app_bytalkcrowdid {
    return [self arrayForKey:APPDefaultsKeyBytalkcrowdid];
}

- (void)app_setBytalkcrowdid:(NSArray*)app_bytalkcrowdid{
    [self setObject:app_bytalkcrowdid forKey:APPDefaultsKeyBytalkcrowdid];
}

- (NSArray *)app_uploadingfiles {
    return [self arrayForKey:APPDefaultsKeyUploadingFiles];
}

- (void)app_setUploadingFiles:(NSArray *)app_uploadingfiles{
    [self setObject:app_uploadingfiles forKey:APPDefaultsKeyUploadingFiles];
}
- (NSArray *)app_uploadingfilesforgroupchat {
    return [self arrayForKey:APPDefaultsKeyUploadingFilesForGroupChat];
}

- (void)app_setUploadingFilesForGroupChat:(NSArray *)app_uploadingfilesforgroupchat{
    [self setObject:app_uploadingfilesforgroupchat forKey:APPDefaultsKeyUploadingFilesForGroupChat];
}
- (BOOL)app_wantsfullscreen {
    return [[self objectForKey:APPDefaultsKeyWantsFullScreen] boolValue];
}

- (void)app_setWantsFullScreen:(BOOL)app_setWantsFullScreen{
    [self setObject:[NSNumber numberWithBool:app_setWantsFullScreen] forKey:APPDefaultsKeyWantsFullScreen];
}

- (NSString *)app_userStatus {
    return [self stringForKey:APPDefaultsKeyUserStatus];
}

- (void)app_setUserStatus:(NSString *)app_userStatus{
    [self setObject:app_userStatus forKey:APPDefaultsKeyUserStatus];
}

- (BOOL)app_isHaveSound {
    return [[self objectForKey:APPDefaultsKeyIsHaveSound] boolValue];
}
- (void)app_setIsHaveSound:(BOOL)app_setIsHaveSound{
    [self setObject:[NSNumber numberWithBool:app_setIsHaveSound] forKey:APPDefaultsKeyIsHaveSound];
}


//群消息
- (BOOL)app_isHaveGroupSound {
    return [[self objectForKey:APPDefaultsKeyIsHaveGroupSound] boolValue];
}
- (void)app_setIsHaveGroupSound:(BOOL)app_setIsHaveGroupSound{
    [self setObject:[NSNumber numberWithBool:app_setIsHaveGroupSound] forKey:APPDefaultsKeyIsHaveGroupSound];
}

- (BOOL)app_everLaunched {
    return [[self objectForKey:APPDefaultsKeyEverLaunched] boolValue];
}

- (void)app_setEverLaunched:(BOOL)app_setEverLaunched{
    [self setObject:[NSNumber numberWithBool:app_setEverLaunched] forKey:APPDefaultsKeyEverLaunched];
}

- (BOOL)app_firstLaunched {
    return [[self objectForKey:APPDefaultsKeyFirstLaunched] boolValue];
}

- (void)app_setFirstLaunched:(BOOL)app_setFirstLaunched{
    [self setObject:[NSNumber numberWithBool:app_setFirstLaunched] forKey:APPDefaultsKeyFirstLaunched];
}

- (NSString *)app_avatarUploadURL {
    return [self stringForKey:APPDefaultsKeyAvatarUploadURL];
}

- (void)app_setAvatarUploadURL:(NSString *)app_avatarUploadURL{
    [self setObject:app_avatarUploadURL forKey:APPDefaultsKeyAvatarUploadURL];
}

- (NSString *)app_avatarDownloadURL {
    return [self stringForKey:APPDefaultsKeyAvatarDownloadURL];
}

- (void)app_setAvatarDownloadURL:(NSString *)app_setAvatarDownloadURL{
    [self setObject:app_setAvatarDownloadURL forKey:APPDefaultsKeyAvatarDownloadURL];
}

//是否可以创建群组
//@property (assign, getter=app_canCreateGroup,
//           setter=app_setCanCreateGroup:) NSString *app_canCreateGroup;

//
//@property (assign, getter=app_canSendNotice,
//           setter=app_setCanSendNotice:) NSString *app_canSendNotice;
- (NSString *)app_canCreateGroup {
    return [self stringForKey:APPDefaultsKeyCanCreateGroup];
}

- (void)app_setCanCreateGroup:(NSString *)canCreateGroup{
    [self setObject:canCreateGroup forKey:APPDefaultsKeyCanCreateGroup];
}

- (NSString *)app_canSendNotice {
    return [self stringForKey:APPDefaultsKeyCanSendNotice];
}

- (void)app_setCanSendNotice:(NSString *)canSendNotice{
    [self setObject:canSendNotice forKey:APPDefaultsKeyCanSendNotice];
}

//- (NSInteger)app_groupTreeVersion {
//    return [self integerForKey:APPDefaultsKeyGroupTreeVersion];
//}
//
//- (void)app_setGroupTreeVersion:(NSInteger)app_groupTreeVersion{
//    [self setObject:[NSNumber numberWithInteger:app_groupTreeVersion] forKey:APPDefaultsKeyGroupTreeVersion];
//}

-(NSString *)app_userInputName{
    return [self stringForKey:APPDefaultsKeyUserInputName];
}
- (void)app_setUserInputName:(NSString *)app_userInputName{
    [self setObject:app_userInputName forKey:APPDefaultsKeyUserInputName];
}

- (NSString *)app_icantalk
{
    return [self stringForKey:APPDefaultsKeyICanTalk];
}

- (void)app_setIcantalk:(NSString *)app_icantalk
{
    [self setObject:app_icantalk forKey:APPDefaultsKeyICanTalk];
}

@end